package commons.monitor;

import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.services.cloudwatch.AmazonCloudWatch;
import com.amazonaws.services.cloudwatch.AmazonCloudWatchClient;
import commons.client.UserModel;

public class CloudWatchReceiver {
	
	private static AmazonCloudWatch cloudWatch;
	
	private CloudWatchReceiver() {
		cloudWatch = new AmazonCloudWatchClient(new AWSCredentials() {
			@Override
			public String getAWSSecretKey() {
				return System.getProperty(UserModel.AWS_SECRET_KEY);
			}
			@Override
			public String getAWSAccessKeyId() {
				return System.getProperty(UserModel.AWS_ACCESS_KEY_ID);
			}
		});
	}
	
	public static AmazonCloudWatch getMonitor() {
		if(cloudWatch == null) {
			new CloudWatchReceiver();
		} return cloudWatch;	
	}
	
}